import 'package:flutter/material.dart';
import 'package:shop/pages/lease_tools_screen.dart';
import 'package:shop/pages/train_screen.dart';
import 'package:shop/pages/home_screen.dart';
import 'package:shop/pages/select_buy_screen.dart';

class BottomNavigationWidget extends StatefulWidget{

  @override
  State<StatefulWidget> createState() => BottomNavigationWidgetState();
}

class BottomNavigationWidgetState extends State<BottomNavigationWidget>{
  final _bottomNavigationColor = Colors.blue;
  int _currentIndex = 0;
  List<Widget> list = List();

  @override
  void initState(){
//    list
//      ..add(HomeScreen())
//      ..add(EmailScreen())
//      ..add(PagesScreen())
//      ..add(AirPlayScreen());
    super.initState();
  }

  @override
  Widget build(BuildContext context){
    return Scaffold(
      body: list[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
            icon: Icon(
              Icons.home,
              color: _bottomNavigationColor,
            ),
            title: Text(
              'HOME',
              style: TextStyle(color: _bottomNavigationColor),
            ),
          ),

          BottomNavigationBarItem(
            icon: Icon(
              Icons.email,
              color: _bottomNavigationColor,
            ),
            title: Text(
              'EMAIL',
              style: TextStyle(color: _bottomNavigationColor),
            ),
          ),

          BottomNavigationBarItem(
            icon: Icon(
              Icons.pages,
              color: _bottomNavigationColor,
            ),
            title: Text(
              'PAGES',
              style: TextStyle(color: _bottomNavigationColor),
            ),
          ),

          BottomNavigationBarItem(
            icon: Icon(
              Icons.airplay,
              color: _bottomNavigationColor,
            ),
            title: Text(
              'AIRPLAY',
              style: TextStyle(color: _bottomNavigationColor),
            ),
          ),
        ],

        currentIndex: _currentIndex,
        onTap: (int index){
          setState(() {
            _currentIndex = index;
          });
        },
        type: BottomNavigationBarType.shifting,
      ),
    );
  }
}